home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / DevCon88.1 / JimmDemos / DemoSource / ucop.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.2 KB  |  49 lines

  1. /* ucop.c -- set up user copper list for custom viewports
  2.  * Copyright (c) 1988, I and I Computing, and Commodore-Amiga, Inc.
  3.  *
  4.  * Executables based on this information may be used in software
  5.  * for Commodore Amiga computers.  All other rights reserved.
  6.  *
  7.  * This information is provided "as is"; no warranties are made.
  8.  * All use is at your own risk, and no liability or responsibility is assumed.
  9.  */
  10.  
  11. #include "sysall.h"
  12.  
  13. /*
  14.  * small version of what can be found in cpr.c.
  15.  * creates a small user copper list which causes an
  16.  * interrupt near the bottom of my viewport.
  17.  */
  18. struct UCopList    *
  19. createUCop( vpos, hpos )
  20. {
  21.     struct UCopList    *ucl;
  22.  
  23.     /* I will free this myself    */
  24.     if ( !(ucl = AllocMem( (LONG) sizeof (struct UCopList), 
  25.         (LONG) MEMF_CHIP | (LONG) MEMF_CLEAR) )) return ( NULL );
  26.  
  27.     CINIT( ucl, 10L );
  28.     CWAIT( ucl, (long) vpos, (long) 0 );
  29.     /* note that intreq bit 15 is set to indicate that 
  30.      * i want to *set* bit 4, the copper interrupt
  31.      */
  32.     CMOVE( ucl, custom.intreq, (long) (1<<15) | (1<<4) );
  33.     CEND( ucl );
  34.  
  35.     return ( ucl );
  36. }
  37.  
  38.  
  39. /* free the UCL allocated above    */
  40. freeUCop( ucl )
  41. struct UCopList *ucl;
  42. {
  43.     if ( ucl )
  44.     {
  45.         FreeCopList( ucl->FirstCopList );
  46.         FreeMem( ucl, (LONG) sizeof (struct UCopList) );
  47.     }
  48. }
  49.